home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
A is for ART, C is for Cezanne
/
A is for ART, C is for Cezanne.iso
/
mac
/
SETUP.RUL
< prev
next >
Wrap
Text File
|
1996-05-22
|
9KB
|
284 lines
/*----------------------------------------------------------------------------*\
*
* File Name: SETUP.RUL
*
* Description: Cezanne Windows 3.1/Windows 95 Installation
*
* Author: Randall Isaac, C-Wave. Date: 5-9-96
*
* Comments: This script performs a basic installation from a CD to
* a Windows 95 or Windows 3.1 platform.
*
\*----------------------------------------------------------------------------*/
declare
// Constant declarations.
#define SPACE_REQUIRED 3500000 // Disk space in bytes.
#define APP_NAME "CEZANNE"
#define PROGRAM_FOLDER_NAME "A is for Art"
#define APPBASE_PATH "Cezanne\\"
#define COMPANY_NAME "C-Wave"
#define PRODUCT_NAME "Cezanne"
#define PRODUCT_VERSION "1.0"
#define DEINSTALL_KEY "CezanneDeinstKey"
#define UNINSTALL_NAME "Cezanne"
#define PRODUCT_KEY "Cezanne.exe"
#define EXE_NAME "Cezanne.exe"
#define MEDIA_DIR "Data\\"
#define MEDIA_SRC "Data\\"
#define PROGRAM_SRC "Cezanne\\"
#define INI_FILE "Lingo.INI"
#define README_FILE "Readme.txt"
// Global variable declarations.
STRING svFolder, svDir, szMsg, szFileSet, szMediaPath, szTitle, svUninstLogFile;
STRING svTarget, szProgram, szReadme, szTemp, szAppPath, szInstallPath;
BOOL bSpaceOk, bWinNT, bWin32s, bWin31, bIsShellExplorer;
NUMBER nResult, nvINI, nDLLResult;
// Internal Function declarations.
prototype SetupScreen();
prototype CheckRequirements();
program
StartHere:
Disable( BACKGROUND );
// Set installation info., which is required for registry entries.
InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
// Set up thr installation screen.
SetupScreen();
Enable( DIALOGCACHE );
// Create a Welcome dialog.
WelcomeDlg:
Disable( BACKBUTTON );
Welcome( "", 0 );
Enable( BACKBUTTON );
// Test target system for proper configuration.
CheckRequirements();
// Ask user for a destination location for the installation.--
GetTargetDirectory:
svTarget = TARGETDISK ^ APPBASE_PATH;
if ( AskDestPath( "", szMsg,
svTarget, 0 ) = 12 ) then
goto WelcomeDlg;
endif;
// Perform space check of target drive.
bSpaceOk = TRUE;
if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svTarget + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
// If not enough space, ask user to try again.
if (bSpaceOk = FALSE) goto GetTargetDirectory;
// Set the App Paths key for the main program.
szAppPath = svTarget ^ "PROGRAM";
RegDBSetItem( REGDB_APPPATH, szAppPath );
szProgram = svTarget ^ EXE_NAME;
RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
TARGETDIR = svTarget ^ "\\"; //ensure trailing '\'
CreateMediaSubDir:
//Now define the media subdirectory
szTemp= TARGETDIR ^ MEDIA_DIR; //create subdir path
if ( ExistsDir( szTemp ) = NOTEXISTS ) then
CreateDir( szTemp );
endif;
TransferFiles:
// Prepare InstallShield to record deinstallation information.
DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
// Set up progress indicator and information gauge.
Disable( DIALOGCACHE );
Enable( STATUSDLG );
// Perform the file set.
SetStatusWindow( 5, "Copying program files..." );
VarSave(SRCTARGETDIR);
StatusUpdate( ON, 20 );
if ( bWin31 ) then
CopyFile( "Uninst16.exe", "UnInst16.exe" );
else
CopyFile( "Uninst.exe", "UnInst.exe" );
endif;
StatusUpdate( ON, 25 );
CopyFile( README_FILE, README_FILE );
SRCDIR = SRCDIR ^ PROGRAM_SRC;
StatusUpdate( ON, 70 );
if ( bWin31 ) then
CopyFile( "CezWin31.exe", EXE_NAME );
else
CopyFile( "CezWin95.exe", EXE_NAME );
endif;
CopyFile( INI_FILE, INI_FILE ); //move INI so it will be registered
// for uninstall.
TARGETDIR = TARGETDIR ^ MEDIA_DIR;
SRCDIR = SRCDIR ^ MEDIA_SRC;
StatusUpdate( ON, 90 );
XCopyFile( "*.*", "*.*", INCLUDE_SUBDIR );
VarRestore(SRCTARGETDIR);
Delay( 1 );
Disable( STATUSDLG );
//Add a line to the INI file with source CD drive
CreateINI:
szTemp = "CDROM=" + SRCDIR;
OpenFileMode( FILE_MODE_APPEND );
OpenFile( nvINI, TARGETDIR, INI_FILE );
WriteLine( nvINI, szTemp );
CloseFile( nvINI );
// Create program folders and icons.
InstallProgramItems:
SetStatusWindow( 90, "Creating Program Folder and Icons...." );
// create program group
if ( CreateProgramFolder( PROGRAM_FOLDER_NAME ) < 0 ) then
MessageBox( "Failed to create program folder.", SEVERE );
exit;
endif;
// create program icon
szProgram = TARGETDIR ^ EXE_NAME;
szReadme = TARGETDIR ^ README_FILE;
LongPathToQuote( szProgram, TRUE );
AddFolderIcon( PROGRAM_FOLDER_NAME, APP_NAME, szProgram,
TARGETDIR, "", 0, "", REPLACE );
AddFolderIcon( PROGRAM_FOLDER_NAME, "Read Me", szReadme,
TARGETDIR, "", 0, "", REPLACE );
Delay( 1 );
// Announce setup complete and offer to read README file.e
FinalInstallProcess:
SetStatusWindow( 100, "Installation complete." );
if (AskYesNo( "Do you want to view the README file now?", YES ) = YES) then
LaunchAppAndWait( "NOTEPAD.EXE", svTarget ^ "README.TXT", WAIT );
Delay( 1 );
endif;
szMsg = "Setup is complete. You may run the installed program "+
"by double-clicking on the program icon.";
MessageBox( szMsg, INFORMATION );
exit;
/*---------------------------------------------------------------------------*\
*
* Function: SetupScreen
*
* Purpose: This function will set up the screen look. This includes
* colors, fonts, text to be displayed, etc.
*
*
* Comments:
\*---------------------------------------------------------------------------*/
function SetupScreen()
number nDx, nDy;
begin
GetExtents( nDx, nDy );
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
Enable( BITMAP256COLORS );
SetTitle( "Installing " + APP_NAME, 24, WHITE );
SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
SetColor( STATUSBAR, BLUE ); // Bright blue.
SetTitle( "Cezanne Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
Enable( BACKGROUND );
//Place custom bitmap and install windows
szInstallPath = SRCDIR ^ "INSTALL.BMP";
PlaceBitmap( szInstallPath, 0, 15, 15, UPPER_RIGHT );
SetInfoWindow( "Information", "Info1.txt" );
Delay( 1 );
end;
/*---------------------------------------------------------------------------*\
*
* Function: CheckRequirements
*
* Purpose: This function will check all minimum requirements for the
* application being installed. If any fail, then the user
* is informed and the installation is terminated.
*
*
* Comments:
\*---------------------------------------------------------------------------*/
function CheckRequirements()
number nvDx, nvDy;
number nvResult;
STRING svResult;
begin
// Check screen resolution.
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( "This program requires VGA or better resolution.", WARNING );
exit;
endif;
// Determine the target system's operating system.
GetSystemInfo( OS, nvResult, svResult );
bWinNT = FALSE;
bWin32s = FALSE;
bWin31 = FALSE;
bIsShellExplorer = FALSE;
if ( nvResult = IS_WINDOWS ) then
bWin31 = TRUE; // this is a Win31 system
endif;
if (nvResult = IS_WINDOWSNT) then
bWinNT = TRUE; // Running Windows NT.
// Check to see if NT is using EXPLORER Shell
if( QueryShellMgr( svResult ) = 0 ) then
if( StrCompare( svResult, "EXPLORER.EXE" ) = 0 ) then
bIsShellExplorer = TRUE;
endif;
endif;
elseif (nvResult = IS_WIN32S) then
bWin32s = TRUE; // Running Win32s.
endif;
end;